﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Menu.Master" AutoEventWireup="true" CodeBehind="frmCurso.aspx.cs" Inherits="GestionCurriculos.frmCurso" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script>
        function ConfirmDelete(codCurso) {
            if (codCurso == 0) {
                alert('No existen cursos a eliminar.');
            } else {
                if (confirm("Esta seguro de eliminar el curso con código " + codCurso)) {
                    document.getElementById("ContentPlaceHolder1_hidCodCurso").value = codCurso;
                    document.getElementById("ContentPlaceHolder1_btnEliminarTrue").click();
                } else {
                    document.getElementById("ContentPlaceHolder1_hidCodCurso").value = 0;
                }
            }
        }
        function CheckOne(obj) {
            var grid = obj.parentNode.parentNode.parentNode;
            var inputs = grid.getElementsByTagName("input");
            var row = obj.parentNode.parentNode;

            for (var i = 0; i < inputs.length; i++) {
                if (inputs[i].type == "checkbox") {
                    if (obj.checked && inputs[i] != obj && inputs[i].checked) {
                        inputs[i].checked = false;

                        var gvDrv = document.getElementById("<%=gvCursos.ClientID %>");
                        for (i = 1; i < gvDrv.rows.length; i++) {
                            gvDrv.rows[i].style.border = "initial";
                        }
                    }
                }
            }

            if (obj.checked) {
                row.style.border = "solid";
            }
            else {
                row.style.border = "initial";
            }
        }

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div style="margin:5px; font-family:Rambla">
    <asp:HiddenField runat="server" ID="hidCodCurso"/>
    <div style="text-align:center">
        <h1> Lista de Cursos </h1>
    </div>

    <!-- BOTONERA -->
    <div style="width:90%; height:25px; background-color:#064066;">
        &nbsp;&nbsp;
        <asp:Button runat="server" ID="btnCrear" Text="Crear" onclick="btnCrear_Click"/>
        <asp:Button runat="server" ID="btnModificar" Text="Modificar" 
            onclick="btnModificar_Click"/>
        <asp:Button runat="server" ID="btnEliminar" Text="Eliminar" 
            onclick="btnEliminar_Click"/>
        <asp:Button runat="server" ID="btnEliminarTrue" Text="Eliminar" style="display:none"
            onclick="btnEliminarTrue_Click"/>
    </div>
    <!-- GRILLA -->
    <div>
        <div>
            <table>
                <tr>
                    <td>Nombre del Curso</td>
                    <td>:</td>
                    <td><asp:TextBox runat="server" ID="txtCurso"  Width="180"></asp:TextBox></td>
                    <td>&nbsp;&nbsp;</td>
                    <td>Área de Conocimiento</td>
                    <td>:</td>
                    <td><asp:DropDownList runat="server" ID="cboAreaConocimiento" Width="180"></asp:DropDownList></td>
                    <td>&nbsp;&nbsp;</td>
                    <td><asp:Button runat="server" ID="btnConsultar" Text="Consultar" 
                            onclick="btnConsultar_Click"/></td>
                </tr>
            </table>
        </div>
        <div style="margin-top:5px">
            <asp:GridView runat="server" ID="gvCursos" AutoGenerateColumns="False" 
                CellPadding="4" ForeColor="#333333" GridLines="Vertical" Width="85%" style="text-align:left"
               ><%-- OnRowDataBound="gvCursos_RowDataBound" --%>
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:CheckBox runat="server" id="chkCurso" onclick ="CheckOne(this)"/>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="codCurso" HeaderText="Código de Curso" />
                    <asp:BoundField DataField="nomCurso" HeaderText="Nombre del Curso" />
                    <asp:BoundField DataField="canHoras" HeaderText="Cantidad de Horas" />
                    <asp:BoundField DataField="creditos" HeaderText="Número de Créditos" />
                    <asp:BoundField DataField="titulo" HeaderText="Área Conocimiento" />
                </Columns>
                <EditRowStyle BackColor="#2461BF" />
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#064066" Font-Bold="True" ForeColor="White" BorderColor="Black" BorderStyle="solid" BorderWidth="1px" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#EFF3FB" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#F5F7FB" />
                <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                <SortedDescendingCellStyle BackColor="#E9EBEF" />
                <SortedDescendingHeaderStyle BackColor="#4870BE" />
            </asp:GridView>
        </div>
    </div>
</div>
<!-- <RowStyle BackColor="#EFF3FB"  BorderColor="Black" BorderStyle="solid" BorderWidth="1px"  /> -->
</asp:Content>
